home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / CURSES.H < prev    next >
Text File  |  1993-01-18  |  47KB  |  1,003 lines

  1. /* $Header: c:/curses/RCS/curses.h%v 2.0 1992/11/16 22:40:30 MH Rel $
  2. *----------------------------------------------------------------------
  3. *                              PDCurses
  4. *----------------------------------------------------------------------
  5. * MH
  6. *      921120  2.0     Changed #if to #ifdef/#if defined to make it
  7. *                      easier to add new platforms/compilers.
  8. *
  9. *                      Added System V colour support.
  10. *
  11. *                      Added OS/2 port.
  12. *-------
  13. * Frotz
  14. *      911221  2.0 pre-beta    Changed back from short to int. (int is the
  15. *                      correct size for the default platform.  Short
  16. *                      might be too short on some platforms.  This
  17. *                      is more portable.  I, also, made this mistake.)
  18. *
  19. *                      Many functions are now macros.  If you want
  20. *                      the real thing, #undef the macro. (X/Open
  21. *                      requirement.)
  22. *
  23. *                      Merged many sources into current release.
  24. *
  25. *                      Added many X/Open routines (not quite all yet).
  26. *
  27. *                      Added internal documentation to all routines.
  28. *
  29. *                      Added a HISTORY file to the environment.
  30. *
  31. *                      Added a CONTRIB file to the environment.
  32. *-------
  33. * bl   900114  1.4     Window origin mod in overlay() and overwrite(), on
  34. *                      public (and very reasonable) request. Swapped
  35. *                      #define'd values of OK and ERR; OK now 1, and
  36. *                      ERR is 0/NULL. Conforms better to UNIX
  37. *                      versions.  borderchars[] removed from WINDOW
  38. *                      struct since the border() functions were
  39. *                      redefined. Use of short wherever possible.
  40. *                      Portability improvements, mispelled name of
  41. *                      [w]setscrreg().
  42. *
  43. *      881005  1.3     All modules lint-checked with MSC '-W3' and
  44. *                      turbo'C' '-w -w-pro' switches. Support for
  45. *                      border(), wborder() functions.
  46. *
  47. *      881002  1.2     Rcsid[] string in all modules, for maintenance.
  48. *
  49. *      880306  1.1     'Raw' output routines, revision info in curses.h.
  50. *
  51. *      870515  1.0     Initial Release.
  52. *
  53. *----------------------------------------------------------------------
  54. */
  55.  
  56. #ifndef  __PDCURSES__
  57. #define        __PDCURSES__ 1
  58.  
  59. /*man-start*********************************************************************
  60.  
  61. All defines are "defined" here.  All compiler and environment
  62. specific definitions are defined into generic class defines.
  63. These defines are to be given values so that the code can
  64. rely on #if, rather than a complicated set of #if defined() or
  65. #ifdefs...
  66.  
  67. PDCurses definitions list:  (Only define those needed)
  68.  
  69.        REGISTERWINDOWS True for auto window update registery.
  70.        FAST_VIDEO      True if display is memory mapped, or
  71.                        we can utilize the fast video update routines.
  72.        DOS             True if compiling for DOS.
  73.        OS2             True if compiling for OS/2.
  74.        FLEXOS          True if compiling for Flexos.
  75.        HC              True if using a Metaware compiler.
  76.        TC              True if using a Borland compiler.
  77.        MSC             True if using a Microsoft compiler.
  78.        ANSI            True if the compiler supports ANSI C and
  79.                        (full or mixed) prototypes.
  80.        CPLUSPLUS       True if the compiler supports C++.
  81.  
  82. PDCurses portable platform definitions list:
  83.  
  84.        PDCurses        Enables access to PDCurses-only routines.
  85.        XOPEN           Always true.
  86.        SYSV            True if you are compiling for SYSV portability.
  87.        BSD             True if you are compiling for BSD portability.
  88.        INTERNAL        Enables access to internal PDCurses routines.
  89. **man-end**********************************************************************/
  90.  
  91. #define        PDCURSES        1       /* PDCurses-only routines       */
  92. #define        XOPEN           1       /* X/Open Curses routines       */
  93. #define        SYSV            1       /* System V Curses routines     */
  94. #define        BSD             1       /* BSD Curses routines          */
  95. #define        INTERNAL        1       /* PDCurses Internal routines   */
  96.  
  97.  
  98. /*----------------------------------------
  99. *       BORLAND COMPILERS       Turbo C[++], Borland C[++]
  100. *
  101. *       Borland definitions:
  102. *               TC
  103. *               DOS
  104. *               FLEXOS
  105. *               CPLUSPLUS
  106. *
  107. *               __TURBOC__ & __MSDOS__ are predefined by compiler.
  108. */
  109. #ifdef __TURBOC__              /* Borland gives defines this as a value*/
  110. #  define TC    __TURBOC__     /* Define a value for TC                */
  111. #  define ANSI  1              /* Borland supports ANSI C prototypes   */
  112. #  ifdef __MSDOS__
  113. #    define DOS 6              /* Major release of DOS supported       */
  114. #    include <bios.h>
  115. #    include <dos.h>
  116. #  endif
  117. #  ifdef __FLEXOS__            /* define this on the command line      */
  118. #    define FLEXOS 2           /* or latest major release value.       */
  119. #  endif
  120. #  if __TURBOC__ >= 0x290
  121. #    ifdef  __BCPLUSPLUS__
  122. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  123. #    endif
  124. #    ifdef  __TCPLUSPLUS__
  125. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  126. #    endif
  127. #    ifdef  __CPLUSPLUS__
  128. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  129. #    endif
  130. #  endif
  131. #endif
  132.  
  133.  
  134. /*----------------------------------------
  135. *       METAWARE COMPILERS      High C
  136. *
  137. *       Metaware definitions:
  138. *               HC
  139. *               DOS
  140. *               FLEXOS
  141. */
  142. #ifdef __HIGHC__
  143. #  define HC    1
  144. #  pragma off(prototype_override_warnings)
  145. #  define ANSI  1              /* Metaware supports ANSI C prototypes  */
  146. #  ifdef __MSDOS__
  147. #    define DOS 6              /* Major release of DOS supported       */
  148. #    include <bios.h>
  149. #    include <dos.h>
  150. #  endif
  151. #  ifdef __FLEXOS__            /* define this on the command line      */
  152. #    define FLEXOS 2           /* or latest major release value.       */
  153. #  endif
  154. #endif
  155.  
  156. /*----------------------------------------
  157. *       MICROSOFT COMPILERS      MSC
  158. *
  159. *       Microsoft definitions:
  160. *               MSC
  161. *               DOS || OS2
  162. */
  163. #ifdef _MSC_VER                                 /* defined by compiler */
  164. #  define MSC   1
  165. #  define ANSI  1              /* Microsoft supports ANSI C prototypes */
  166. #  ifdef __OS2__                /* You will have to define in makefile */
  167. #    define USE_OS2_H 1             /* Use the os2.h for the compiler  */
  168. #    define OS2 2                   /* Major release of OS/2 supported */
  169. #    define INCL_VIO
  170. #    define INCL_KBD
  171. #    include <os2.h>
  172. #    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  173. #    define FARKeyword far
  174. #    define APIRET USHORT
  175. #    undef MSDOS                        /* have to undef this for OS/2 */
  176. #  endif
  177. #  ifdef MSDOS          /* defined by compiler (for both DOS and OS/2) */
  178. #    define DOS 6                    /* Major release of DOS supported */
  179. #    include <bios.h>
  180. #    include <dos.h>
  181. #    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  182. #  endif
  183. #endif
  184.  
  185. /*----------------------------------------
  186. *       TOPSPEED compilers     TSC
  187. *
  188. *       TOPSPEED definitions:
  189. *               TSC
  190. *               DOS || OS2
  191. */
  192. #ifdef __TSC__                   /* You may have to define in makefile */
  193. #  define TSC   1
  194. #  define ANSI  1              /* TopSpeed supports ANSI C prototypes  */
  195. #  ifdef __OS2__
  196. #    define OS2 2                   /* Major release of OS/2 supported */
  197. #    include <cursos2.h>
  198. #  endif
  199. #endif
  200.  
  201. /*----------------------------------------
  202. *       IBM C Set/2 Compiler   CSET2
  203. *
  204. *       IBM definitions:
  205. *               CSET2
  206. *               OS2
  207. */
  208. #ifdef __IBMC__
  209. #  define CSET2 1
  210. #  define ANSI  1               /* C Set/2 supports ANSI C prototypes  */
  211. #  ifdef __OS2__
  212. #    define OS2 2                   /* Major release of OS/2 supported */
  213. #    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  214. #    define INCL_VIO
  215. #    define INCL_KBD
  216. #    include <os2.h>
  217. #  endif
  218. #endif
  219.  
  220. /*----------------------------------------
  221. *       GNU compilers     emx
  222. *
  223. *       emx definitions:
  224. *               EMX
  225. *               OS2
  226. */
  227. #ifdef __EMX__                   /* You may have to define in makefile */
  228. #  define EMX   1
  229. #  define ANSI  1                   /* GNU supports ANSI C prototypes  */
  230. #  ifdef __OS2__
  231. #    define OS2 2                   /* Major release of OS/2 supported */
  232. #    define CURSES__32BIT__
  233. #    include <cursos2.h>
  234. #  endif
  235. #endif
  236.  
  237. /*----------------------------------------
  238. *       Watcom C/386 9.0X compiler
  239. *
  240. *       WATCOM definitions:
  241. *               WATCOMC
  242. *               OS2
  243. */
  244. #ifdef __WATCOMC__
  245. #  define WATCOMC  1
  246. #  define ANSI  1          /* Watcom C/386 supports ANSI C prototypes  */
  247. #  ifdef __OS2__
  248. #    define OS2 2                   /* Major release of OS/2 supported */
  249. #    define CURSES__32BIT__
  250. #    define NO_MEMORY_H      /* this compiler does not have a memory.h */
  251. #    define INCL_VIO
  252. #    define INCL_KBD
  253. #    include <os2.h>
  254. #  endif
  255. #endif
  256.  
  257. /*---------------------------------------------------------------------*/
  258.  
  259. #include <stdio.h>             /* Required by X/Open usage below       */
  260.  
  261.  
  262.  
  263. /*----------------------------------------------------------------------
  264.  *
  265.  *     PDCurses Manifest Constants
  266.  *
  267.  */
  268. #ifndef FALSE                  /* booleans              */
  269. #  define      FALSE   0
  270. #endif
  271. #ifndef        TRUE                    /* booleans              */
  272. #  define      TRUE    !FALSE
  273. #endif
  274. #ifndef        NULL
  275. #  define NULL ((void*)0)      /* Null pointer          */
  276. #endif
  277. #define         ERR    0               /* general error flag    */
  278. #define         OK     1               /* general OK flag       */
  279.  
  280.  
  281.  
  282.  
  283. /*----------------------------------------------------------------------
  284.  *
  285.  *     PDCurses Type Declarations
  286.  *
  287.  */
  288. typedef unsigned char bool;    /* PDCurses Boolean type        */
  289. typedef unsigned short chtype; /* 8-bit attr + 8-bit char      */
  290.  
  291.  
  292.  
  293.  
  294. /*----------------------------------------------------------------------
  295.  *
  296.  *     PDCurses Structure Definitions:
  297.  *
  298.  */
  299. typedef struct _win            /* definition of a window.         */
  300. {
  301.        int     _cury;          /* current pseudo-cursor           */
  302.        int     _curx;
  303.        int     _maxy;          /* max window coordinates          */
  304.        int     _maxx;
  305.        int     _pmaxy;         /* max physical size               */
  306.        int     _pmaxx;
  307.        int     _begy;          /* origin on screen                */
  308.        int     _begx;
  309.        int     _flags;         /* window properties               */
  310.        chtype  _attrs;         /* standard A_STANDOUT attributes and colors  */
  311.        int     _tabsize;       /* tab character size              */
  312.        bool    _clear;         /* causes clear at next refresh    */
  313.        bool    _leave;         /* leaves cursor as it happens     */
  314.        bool    _scroll;        /* allows window scrolling         */
  315.        bool    _nodelay;       /* input character wait flag       */
  316.        bool    _use_keypad;    /* flags keypad key mode active    */
  317.        bool    _use_idl;       /* True if Ins/Del line can be used*/
  318.        chtype**_y;             /* pointer to line pointer array   */
  319.        int*    _firstch;       /* first changed character in line */
  320.        int*    _lastch;        /* last changed character in line  */
  321.        int     _tmarg; /* top of scrolling region         */
  322.        int     _bmarg; /* bottom of scrolling region      */
  323.        chtype  _borderchars[8];/* non-std border chars            */
  324.        char*   _title;         /* window title                    */
  325.        char    _title_ofs;     /* window title offset from left   */
  326.        chtype  _title_attr;    /* window title attributes         */
  327.        chtype  _blank;         /* window's blank character        */
  328. struct _win*   _parent;        /* subwin's pointer to parent win  */
  329. }      WINDOW;
  330.  
  331.  
  332.  
  333. /*----------------------------------------------------------------------
  334. *
  335. *      Private structures that are necessary for correct
  336. *      macro construction.
  337. *
  338. */
  339.  
  340. #ifdef REGISTERWINDOWS
  341. typedef struct _ref            /* Refresh Window Structure      */
  342. {
  343.        WINDOW* win;
  344. struct _ref*   next;
  345. struct _ref*   tail;
  346. }      ACTIVE;
  347.  
  348. typedef struct _wins
  349. {
  350.        WINDOW*         w;      /* pointer to a visible window      */
  351.        struct _wins*   next;   /* Next visible window pointer      */
  352.        struct _wins*   prev;   /* Next visible window pointer      */
  353.        struct _wins*   tail;   /* Last visible window pointer      */
  354.                                /* Only head window (stdscr) has    */
  355.                                /* a valid tail pointer.            */
  356. }      WINDS;
  357. #endif
  358.  
  359.  
  360.  
  361.  
  362. typedef struct
  363. {
  364.        bool    alive;          /* TRUE if already opened.          */
  365.        bool    autocr;         /* if lf -> crlf                    */
  366.        bool    cbreak;         /* if terminal unbuffered           */
  367.        bool    echo;           /* if terminal echo                 */
  368.        bool    raw_inp;        /* raw input mode (v. cooked input) */
  369.        bool    raw_out;        /* raw output mode (7 v. 8 bits)    */
  370.        bool    refrbrk;        /* if premature refresh brk allowed */
  371.        bool    orgcbr;         /* original MSDOS ^-BREAK setting   */
  372.        bool    visible_cursor; /* TRUE if cursor is visible        */
  373.        bool    audible;        /* FALSE if the bell is visual      */
  374.        bool    full_redraw;    /* TRUE for bad performance         */
  375.        bool    direct_video;   /* Allow Direct Screen Memory writes*/
  376.        bool    mono;           /* TRUE if current screen is mono.  */
  377.        bool    sizeable;       /* TRUE if adapter is resizeable.   */
  378.        bool    bogus_adapter;  /* TRUE if adapter has insane values*/
  379.        bool    shell;          /* TRUE if reset_prog_mode() needs  */
  380.                                /*      to be called.               */
  381.        chtype  blank;          /* Background character             */
  382.        chtype  orig_attr;      /* Original screen attributes       */
  383.        int     cursrow;        /* position of physical cursor      */
  384.        int     curscol;        /* position of physical cursor      */
  385.        int     cursor;         /* Current Cursor definition        */
  386.        int     video_page;     /* Current PC video page            */
  387.        int     orig_emulation; /* Original cursor emulation value  */
  388.        int     orig_cursor;    /* Original cursor size             */
  389.        int     font;           /* default font size                */
  390.        int     orig_font;      /* Original font size               */
  391.        int     lines;          /* New value for LINES              */
  392.        int     cols;           /* New value for COLS               */
  393.        int     emalloc;        /* 0x0C0C if initscr() is to reset  */
  394.                                /*     this value to TRUE;          */
  395.                                /* TRUE only if emalloc()/ecalloc() */
  396.                                /*     are is to be used;           */
  397.                                /* FALSE if malloc()/calloc() are   */
  398.                                /*     to be used.                  */
  399. #ifdef OS2
  400.        VIOMODEINFO scrnmode;   /* default screen mode              */
  401.        VIOCONFIGINFO adapter;  /* Screen type                      */
  402. #else
  403.        int     scrnmode;       /* default screen mode              */
  404.        int     adapter;        /* Screen type                      */
  405.        unsigned video_seg;     /* video base segment               */
  406.        unsigned video_ofs;     /* video base offset                */
  407. #endif
  408. #ifdef REGISTERWINDOWS
  409.        WINDS*  visible;        /* List of visible windows          */
  410.        bool    refreshall;     /* Refresh all registered windows?  */
  411. #endif
  412.  
  413. }      SCREEN;
  414.  
  415.  
  416.  
  417.  
  418.  
  419. /* external variables */
  420. extern int     LINES;          /* terminal height              */
  421. extern int     COLS;           /* terminal width               */
  422. extern WINDOW* stdscr;         /* the default screen window    */
  423. extern SCREEN  _cursvar;       /* curses variables             */
  424.  
  425. #if    defined (INTERNAL) | defined (CURSES_LIBRARY)
  426. extern WINDOW* curscr;         /* the current screen image     */
  427. extern WINDOW* tmpwin;         /* the temporary screen image   */
  428. extern int     _default_lines; /* For presetting maximum lines */
  429. #endif
  430.  
  431. #ifdef REGISTERWINDOWS
  432. extern ACTIVE* CurWins;        /* Currently Visible Windows    */
  433. #endif
  434.  
  435.  
  436.  
  437.  
  438. /*man-start*********************************************************************
  439.  
  440. PDCurses Text Attributes:
  441.  
  442. To include colour in PDCurses, a number of things had to be sacrificed
  443. from the strict Unix and System V support.
  444. The main problem is fitting all character attributes and colour into
  445. an unsigned char (all 8 bits!). On System V, chtype is a long on
  446. PDCurses it is a short int.
  447.  
  448. The following is the structure of a win->_attrs chtype:
  449.  
  450. -------------------------------------------------
  451. |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
  452. -------------------------------------------------
  453.  colour number |  attrs |   character eg 'a'
  454.  
  455. the high order char is an index into an array of physical colours
  456. (defined in INITPAIR.c). 32 (5 bits) foreground/background colour
  457. combinations combined with 8 (3 bits) attribute modifiers are
  458. available.
  459.  
  460. The available attribute enhancers are bold, reverse and blink.
  461. All other Unix attributes have no effect as attributes. This
  462. limitation may be overcome in future releases by expanding chtype
  463. to a long.
  464.  
  465. **man-end**********************************************************************/
  466.  
  467. /* Video attribute definitions. */
  468. #define A_NORMAL       (chtype)0x0000          /* SysV */
  469. #define A_ALTCHARSET   (chtype)0x0000          /* X/Open       */
  470. #define A_BLINK                (chtype)0x0400          /* X/Open       */
  471. #define A_BLANK                (chtype)0x0000          /* X/Open       */
  472. #define A_BOLD         (chtype)0x0100          /* X/Open       */
  473. #define A_DIM          (chtype)0x0000          /* X/Open       */
  474. #define A_PROTECT      (chtype)0x0000          /* X/Open       */
  475. #define A_REVERSE      (chtype)0x0200          /* X/Open       */
  476. #define A_STANDOUT     ((chtype)(A_REVERSE | A_BOLD))          /* X/Open       */
  477. #define A_UNDERLINE    (chtype)0x0000          /* X/Open       */
  478. #define A_COLOR        (chtype)0xF800          /*System V      */
  479.  
  480. #define CHR_MSK                (chtype)(0xFF)          /* Obsolete     */
  481. #define ATR_MSK                (chtype)(~CHR_MSK)      /* Obsolete     */
  482. #define ATR_NRM                A_NORMAL                        /* Obsolete     */
  483. #define A_CHARTEXT     CHR_MSK                 /* X/Open       */
  484. #define A_ATTRIBUTES   ATR_MSK                 /* X/Open       */
  485.  
  486. /* ALTCHARSET definitions from jshumate@logds1.wr.aflc.af.mil */
  487. #define ACS_ULCORNER   (chtype)0xda                    /* SysV         */
  488. #define ACS_LLCORNER   (chtype)0xc0                    /* SysV         */
  489. #define ACS_URCORNER   (chtype)0xbf                    /* SysV         */
  490. #define ACS_LRCORNER   (chtype)0xd9                    /* SysV         */
  491. #define ACS_RTEE       (chtype)0xb4                    /* SysV         */
  492. #define ACS_LTEE       (chtype)0xc3                    /* SysV         */
  493. #define ACS_BTEE       (chtype)0xc1                    /* SysV         */
  494. #define ACS_TTEE       (chtype)0xc2                    /* SysV         */
  495. #define ACS_HLINE      (chtype)0xc4                    /* SysV         */
  496. #define ACS_VLINE      (chtype)0xb3                    /* SysV         */
  497. #define ACS_PLUS       (chtype)0xc5                    /* SysV         */
  498. #define ACS_S1 (chtype)0x2d                    /* SysV         */
  499. #define ACS_S9 (chtype)0x5f                    /* SysV         */
  500. #define ACS_DIAMOND    (chtype)0xc5                    /* SysV         */
  501. #define ACS_CKBOARD    (chtype)0xb2                    /* SysV         */
  502. #define ACS_DEGREE     (chtype)0xf8                    /* SysV         */
  503. #define ACS_PLMINUS    (chtype)0xf1                    /* SysV         */
  504. #define ACS_BULLET     (chtype)0xf9                    /* SysV         */
  505. #define ACS_LARROW     (chtype)0x3c                    /* SysV         */
  506. #define ACS_RARROW     (chtype)0x3e                    /* SysV         */
  507. #define ACS_DARROW     (chtype)0x76                    /* SysV         */
  508. #define ACS_UARROW     (chtype)0x5e                    /* SysV         */
  509. #define ACS_BOARD      (chtype)0x23                    /* SysV         */
  510. #define ACS_LANTERN    (chtype)0x23                    /* SysV         */
  511. #define ACS_BLOCK      (chtype)0x23                    /* SysV         */
  512.  
  513. /* the following definitions can be used if you have set raw_output()
  514.    or are using the PDCurses *raw*() functions                        */
  515. #if 0
  516. #define ACS_DIAMOND    (chtype)0x04                    /* SysV         */
  517. #define ACS_LARROW     (chtype)0x1b                    /* SysV         */
  518. #define ACS_RARROW     (chtype)0x1a                    /* SysV         */
  519. #define ACS_DARROW     (chtype)0x19                    /* SysV         */
  520. #define ACS_UARROW     (chtype)0x18                    /* SysV         */
  521. #define ACS_BOARD      (chtype)0xb0                    /* SysV         */
  522. #define ACS_LANTERN    (chtype)0x0f                    /* SysV         */
  523. #define ACS_BLOCK      (chtype)0xdb                    /* SysV         */
  524. #endif
  525.  
  526. /* colour attributes */
  527. #define COLOR_BLACK            0
  528. #define COLOR_BLUE             1
  529. #define COLOR_GREEN            2
  530. #define COLOR_CYAN             3
  531. #define COLOR_RED              4
  532. #define COLOR_MAGENTA          5
  533. #define COLOR_YELLOW           6
  534. #define COLOR_WHITE            7
  535.  
  536. #define COLOR_PAIR(n)  (((n) << 11) & A_ATTRIBUTES)
  537. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
  538.  
  539. extern int COLORS,COLOR_PAIRS;
  540. /*----------------------------------------------------------------------
  541.  *
  542.  *     Function and Keypad Key Definitions.
  543.  *     Many are just for compatibility.
  544.  *
  545.  */
  546. #define KEY_MIN         0x101   /* Minimum curses key value      */
  547. #define KEY_BREAK       0x101   /* Not on PC KBD                 */
  548. #define KEY_DOWN        0x102   /* Down arrow key                */
  549. #define KEY_UP          0x103   /* Up arrow key                  */
  550. #define KEY_LEFT        0x104   /* Left arrow key                */
  551. #define KEY_RIGHT       0x105   /* Right arrow key               */
  552. #define KEY_HOME        0x106   /* home key                      */
  553. #define KEY_BACKSPACE   0x107   /* not on pc                     */
  554. #define KEY_F0          0x108   /* function keys. space for      */
  555. #define KEY_F(n)    (KEY_F0+(n))/* 64 keys are reserved.         */
  556. #define KEY_DL          0x148   /* not on pc                     */
  557. #define KEY_IL          0x149   /* insert line                   */
  558. #define KEY_DC          0x14a   /* delete character              */
  559. #define KEY_IC          0x14b   /* insert char or enter ins mode */
  560. #define KEY_EIC         0x14c   /* exit insert char mode         */
  561. #define KEY_CLEAR       0x14d   /* clear screen                  */
  562. #define KEY_EOS         0x14e   /* clear to end of screen        */
  563. #define KEY_EOL         0x14f   /* clear to end of line          */
  564. #define KEY_SF          0x150   /* scroll 1 line forward         */
  565. #define KEY_SR          0x151   /* scroll 1 line back (reverse)  */
  566. #define KEY_NPAGE       0x152   /* next page                     */
  567. #define KEY_PPAGE       0x153   /* previous page                 */
  568. #define KEY_STAB        0x154   /* set tab                       */
  569. #define KEY_CTAB        0x155   /* clear tab                     */
  570. #define KEY_CATAB       0x156   /* clear all tabs                */
  571. #define KEY_ENTER       0x157   /* enter or send (unreliable)    */
  572. #define KEY_SRESET      0x158   /* soft/reset (partial/unreliable)*/
  573. #define KEY_RESET       0x159   /* reset/hard reset (unreliable) */
  574. #define KEY_PRINT       0x15a   /* print/copy                    */
  575. #define KEY_LL          0x15b   /* home down/bottom (lower left) */
  576. #define KEY_ABORT       0x15c   /* abort/terminate key (any)     */
  577. #define KEY_SHELP       0x15d   /* short help                    */
  578. #define KEY_LHELP       0x15e   /* long help                     */
  579. #define KEY_BTAB        0x15f   /* Back tab key                  */
  580. #define KEY_BEG         0x160   /* beg(inning) key               */
  581. #define KEY_CANCEL      0x161   /* cancel key                    */
  582. #define KEY_CLOSE       0x162   /* close key                     */
  583. #define KEY_COMMAND     0x163   /* cmd (command) key             */
  584. #define KEY_COPY        0x164   /* copy key                      */
  585. #define KEY_CREATE      0x165   /* create key                    */
  586. #define KEY_END         0x166   /* end key                       */
  587. #define KEY_EXIT        0x167   /* exit key                      */
  588. #define KEY_FIND        0x168   /* find key                      */
  589. #define KEY_HELP        0x169   /* help key                      */
  590. #define KEY_MARK        0x16a   /* mark key                      */
  591. #define KEY_MESSAGE     0x16b   /* message key                   */
  592. #define KEY_MOVE        0x16c   /* move key                      */
  593. #define KEY_NEXT        0x16d   /* next object key               */
  594. #define KEY_OPEN        0x16e   /* open key                      */
  595. #define KEY_OPTIONS     0x16f   /* options key                   */
  596. #define KEY_PREVIOUS    0x170   /* previous object key           */
  597. #define KEY_REDO        0x171   /* redo key                      */
  598. #define KEY_REFERENCE   0x172   /* ref(erence) key               */
  599. #define KEY_REFRESH     0x173   /* refresh key                   */
  600. #define KEY_REPLACE     0x174   /* replace key                   */
  601. #define KEY_RESTART     0x175   /* restart key                   */
  602. #define KEY_RESUME      0x176   /* resume key                    */
  603. #define KEY_SAVE        0x177   /* save key                      */
  604. #define KEY_SBEG        0x178   /* shifted beginning key         */
  605. #define KEY_SCANCEL     0x179   /* shifted cancel key            */
  606. #define KEY_SCOMMAND    0x17a   /* shifted command key           */
  607. #define KEY_SCOPY       0x17b   /* shifted copy key              */
  608. #define KEY_SCREATE     0x17c   /* shifted create key            */
  609. #define KEY_SDC         0x17d   /* shifted delete char key       */
  610. #define KEY_SDL         0x17e   /* shifted delete line key       */
  611. #define KEY_SELECT      0x17f   /* select key                    */
  612. #define KEY_SEND        0x180   /* shifted end key               */
  613. #define KEY_SEOL        0x181   /* shifted clear line key        */
  614. #define KEY_SEXIT       0x182   /* shifted exit key              */
  615. #define KEY_SFIND       0x183   /* shifted find key              */
  616. #define KEY_SHOME       0x184   /* shifted home key              */
  617. #define KEY_SIC         0x185   /* shifted input key             */
  618. #define KEY_SLEFT       0x187   /* shifted left arrow key        */
  619. #define KEY_SMESSAGE    0x188   /* shifted message key           */
  620. #define KEY_SMOVE       0x189   /* shifted move key              */
  621. #define KEY_SNEXT       0x18a   /* shifted next key              */
  622. #define KEY_SOPTIONS    0x18b   /* shifted options key           */
  623. #define KEY_SPREVIOUS   0x18c   /* shifted prev key              */
  624. #define KEY_SPRINT      0x18d   /* shifted print key             */
  625. #define KEY_SREDO       0x18e   /* shifted redo key              */
  626. #define KEY_SREPLACE    0x18f   /* shifted replace key           */
  627. #define KEY_SRIGHT      0x190   /* shifted right arrow           */
  628. #define KEY_SRSUME      0x191   /* shifted resume key            */
  629. #define KEY_SSAVE       0x192   /* shifted save key              */
  630. #define KEY_SSUSPEND    0x193   /* shifted suspend key           */
  631. #define KEY_SUNDO       0x194   /* shifted undo key              */
  632. #define KEY_SUSPEND     0x195   /* suspend key                   */
  633. #define KEY_UNDO        0x196   /* undo key                      */
  634.  
  635. /* PDCurses specific key definitions */
  636.  
  637. #define ALT_0           0x197   /* Alt-0                PC only  */
  638. #define ALT_1           0x198   /* Alt-1                PC only  */
  639. #define ALT_2           0x199   /* Alt-2                PC only  */
  640. #define ALT_3           0x19a   /* Alt-3                PC only  */
  641. #define ALT_4           0x19b   /* Alt-4                PC only  */
  642. #define ALT_5           0x19c   /* Alt-5                PC only  */
  643. #define ALT_6           0x19d   /* Alt-6                PC only  */
  644. #define ALT_7           0x19e   /* Alt-7                PC only  */
  645. #define ALT_8           0x19f   /* Alt-8                PC only  */
  646. #define ALT_9           0x1a0   /* Alt-9                PC only  */
  647. #define ALT_A           0x1a1   /* Alt-A                PC only  */
  648. #define ALT_B           0x1a2   /* Alt-B                PC only  */
  649. #define ALT_C           0x1a3   /* Alt-C                PC only  */
  650. #define ALT_D           0x1a4   /* Alt-D                PC only  */
  651. #define ALT_E           0x1a5   /* Alt-E                PC only  */
  652. #define ALT_F           0x1a6   /* Alt-F                PC only  */
  653. #define ALT_G           0x1a7   /* Alt-G                PC only  */
  654. #define ALT_H           0x1a8   /* Alt-H                PC only  */
  655. #define ALT_I           0x1a9   /* Alt-I                PC only  */
  656. #define ALT_J           0x1aa   /* Alt-J                PC only  */
  657. #define ALT_K           0x1ab   /* Alt-K                PC only  */
  658. #define ALT_L           0x1ac   /* Alt-L                PC only  */
  659. #define ALT_M           0x1ad   /* Alt-M                PC only  */
  660. #define ALT_N           0x1ae   /* Alt-N                PC only  */
  661. #define ALT_O           0x1af   /* Alt-O                PC only  */
  662. #define ALT_P           0x1b0   /* Alt-P                PC only  */
  663. #define ALT_Q           0x1b1   /* Alt-Q                PC only  */
  664. #define ALT_R           0x1b2   /* Alt-R                PC only  */
  665. #define ALT_S           0x1b3   /* Alt-S                PC only  */
  666. #define ALT_T           0x1b4   /* Alt-T                PC only  */
  667. #define ALT_U           0x1b5   /* Alt-U                PC only  */
  668. #define ALT_V           0x1b6   /* Alt-V                PC only  */
  669. #define ALT_W           0x1b7   /* Alt-W                PC only  */
  670. #define ALT_X           0x1b8   /* Alt-X                PC only  */
  671. #define ALT_Y           0x1b9   /* Alt-Y                PC only  */
  672. #define ALT_Z           0x1ba   /* Alt-Z                PC only  */
  673. #define CTL_LEFT        0x1bb   /* Control-Left-Arrow   PC only  */
  674. #define CTL_RIGHT       0x1bc   /* Control-Right-Arrow  PC only  */
  675. #define CTL_PGUP        0x1bd   /* Control-PgUp         PC only  */
  676. #define CTL_PGDN        0x1be   /* Control-PgDn         PC only  */
  677. #define CTL_HOME        0x1bf   /* Control-Home         PC only  */
  678. #define CTL_END         0x1c0   /* Control-End          PC only  */
  679. #define KEY_BACKTAB     0x1c1   /* Back-tab             PC only  */
  680.  
  681. #ifdef FLEXOS
  682. #define KEY_A1          KEY_HOME/* upper left on Virtual keypad  */
  683. #define KEY_A2          KEY_UP  /* upper middle on Virt. keypad  */
  684. #define KEY_A3          KEY_PPAGE/* upper right on Vir. keypad   */
  685. #define KEY_B1          KEY_LEFT/* middle left on Virt. keypad   */
  686. #define KEY_B2          0x00    /* center on Virt. keypad        */
  687. #define KEY_B3          KEY_RIGHT/* middle right on Vir. keypad  */
  688. #define KEY_C1          KEY_LL  /* lower left on Virt. keypad    */
  689. #define KEY_C2          KEY_DOWN /* lower middle on Virt. keypad */
  690. #define KEY_C3          KEY_NPAGE /* lower right on Vir. keypad  */
  691. #define KEY_MAX         KEY_BACKTAB /* Maximum curses key        */
  692. #endif
  693.  
  694.  
  695. #if defined(DOS)  || defined (OS2)
  696. #define KEY_A1          0x1c2   /* upper left on Virtual keypad  */
  697. #define KEY_A2          0x1c3   /* upper middle on Virt. keypad  */
  698. #define KEY_A3          0x1c4   /* upper right on Vir. keypad    */
  699. #define KEY_B1          0x1c5   /* middle left on Virt. keypad   */
  700. #define KEY_B2          0x1c6   /* center on Virt. keypad        */
  701. #define KEY_B3          0x1c7   /* middle right on Vir. keypad   */
  702. #define KEY_C1          0x1c8   /* lower left on Virt. keypad    */
  703. #define KEY_C2          0x1c9   /* lower middle on Virt. keypad  */
  704. #define KEY_C3          0x1ca   /* lower right on Vir. keypad    */
  705. #define PADSLASH        0x1cb   /* slash on keypad               */
  706. #define PADENTER        0x1cc   /* enter on keypad               */
  707. #define CTL_PADENTER    0x1cd   /* ctl-enter on keypad           */
  708. #define ALT_PADENTER    0x1ce   /* alt-enter on keypad           */
  709. #define SHF_PADSTOP     0x1cf   /* shift-stop on keypad          */
  710. #define PADSTAR         0x1d0   /* star on keypad                */
  711. #define PADMINUS        0x1d1   /* minus on keypad               */
  712. #define PADPLUS         0x1d2   /* plus on keypad                */
  713. #define CTL_PADSTOP     0x1d3   /* ctl-stop on keypad            */
  714. #define CTL_PADCENTER   0x1d4   /* ctl-enter on keypad           */
  715. #define CTL_PADPLUS     0x1d5   /* ctl-plus on keypad            */
  716. #define CTL_PADMINUS    0x1d6   /* ctl-minus on keypad           */
  717. #define CTL_PADSLASH    0x1d7   /* ctl-slash on keypad           */
  718. #define CTL_PADSTAR     0x1d8   /* ctl-star on keypad            */
  719. #define ALT_PADPLUS     0x1d9   /* alt-plus on keypad            */
  720. #define ALT_PADMINUS    0x1da   /* alt-minus on keypad           */
  721. #define ALT_PADSLASH    0x1db   /* alt-slash on keypad           */
  722. #define ALT_PADSTAR     0x1dc   /* alt-star on keypad            */
  723. #define CTL_INS         0x1dd   /* ctl-insert                    */
  724. #define ALT_DEL         0x1de   /* alt-delete                    */
  725. #define ALT_INS         0x1df   /* alt-insert                    */
  726. #define CTL_UP          0x1e0   /* ctl-up arrow                  */
  727. #define CTL_DOWN        0x1e1   /* ctl-down arrow                */
  728. #define CTL_TAB         0x1e2   /* ctl-tab                       */
  729. #define ALT_TAB         0x1e3   /* alt-tab                       */
  730. #define ALT_MINUS       0x1e4   /* alt-minus                     */
  731. #define ALT_EQUAL       0x1e5   /* alt-equal                     */
  732. #define ALT_HOME        0x1e6   /* alt-home                      */
  733. #define ALT_PGUP        0x1e7   /* alt-pgup                      */
  734. #define ALT_PGDN        0x1e8   /* alt-pgdn                      */
  735. #define ALT_END         0x1e9   /* alt-end                       */
  736. #define ALT_UP          0x1ea   /* alt-up arrow                  */
  737. #define ALT_DOWN        0x1eb   /* alt-down arrow                */
  738. #define ALT_RIGHT       0x1ec   /* alt-right arrow               */
  739. #define ALT_LEFT        0x1ed   /* alt-left arrow                */
  740. #define ALT_ENTER       0x1ee   /* alt-enter                     */
  741. #define ALT_ESC         0x1ef   /* alt-escape                    */
  742. #define ALT_BQUOTE      0x1f0   /* alt-back quote                */
  743. #define ALT_LBRACKET    0x1f1   /* alt-left bracket              */
  744. #define ALT_RBRACKET    0x1f2   /* alt-right bracket             */
  745. #define ALT_SEMICOLON   0x1f3   /* alt-semi-colon                */
  746. #define ALT_FQUOTE      0x1f4   /* alt-forward quote             */
  747. #define ALT_COMMA       0x1f5   /* alt-comma                     */
  748. #define ALT_STOP        0x1f6   /* alt-stop                      */
  749. #define ALT_FSLASH      0x1f7   /* alt-forward slash             */
  750. #define ALT_BKSP        0x1f8   /* alt-backspace                 */
  751. #define CTL_BKSP        0x1f9   /* ctl-backspace                 */
  752. #define CTL_PAD0        0x1fa   /* ctl-keypad 0                  */
  753. #define CTL_PAD1        0x1fb   /* ctl-keypad 1                  */
  754. #define CTL_PAD2        0x1fc   /* ctl-keypad 2                  */
  755. #define CTL_PAD3        0x1fd   /* ctl-keypad 3                  */
  756. #define CTL_PAD4        0x1fe   /* ctl-keypad 4                  */
  757. #define CTL_PAD5        0x1ff   /* ctl-keypad 5                  */
  758. #define CTL_PAD6        0x200   /* ctl-keypad 6                  */
  759. #define CTL_PAD7        0x201   /* ctl-keypad 7                  */
  760. #define CTL_PAD8        0x202   /* ctl-keypad 8                  */
  761. #define CTL_PAD9        0x203   /* ctl-keypad 9                  */
  762. #define CTL_DEL         0x204   /* clt-delete                    */
  763. #define ALT_BSLASH      0x205   /* alt-back slash                */
  764. #define CTL_ENTER       0x206   /* ctl-enter                     */
  765. #define KEY_MAX         CTL_ENTER  /* Maximum curses key         */
  766. #endif
  767.  
  768.  
  769.  
  770. /*----------------------------------------------------------------------
  771. *       PDCurses function declarations
  772. */
  773. #ifdef ANSI
  774. #  ifdef   CPLUSPLUS
  775.      extern "C" {
  776. #  endif
  777. bool    typeahead( FILE* );
  778. char    erasechar( void );
  779. char    killchar( void );
  780. char    wordchar( void );
  781. char*   longname( void );
  782. char*   unctrl( chtype );
  783. int     baudrate( void );
  784. int     beep( void );
  785. int     border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  786. int     can_change_color ( void );
  787. int     clearok( WINDOW*, bool );
  788. int     color_content( int, short*, short*, short* );
  789. int     def_prog_mode( void );
  790. int     def_shell_mode( void );
  791. int     delwin( WINDOW* );
  792. int     delay_output(  int  );
  793. int     doupdate( void );
  794. int     endwin( void );
  795. int     flash( void );
  796. int     flushinp( void );
  797. int     has_colors( void );
  798. int     init_color( int, short, short, short );
  799. int     init_pair( int, short, short );
  800. int     intrflush(  WINDOW*, bool  );
  801. char *  keyname(  int  );
  802. int     mvaddrawch( int, int, chtype );
  803. int     mvaddrawstr( int, int, char* );
  804. int     mvcur( int, int, int, int );
  805. int     mvinsrawch( int, int, chtype );
  806. int     mvprintw( int, int, char*,... );
  807. int     mvwin( WINDOW*, int, int );
  808. int     mvwinsrawch( WINDOW*, int, int, chtype );
  809. int     mvwprintw( WINDOW*, int, int, char*,... );
  810. int     newline( WINDOW*, int );
  811. int     noraw( void );
  812. int     overlay( WINDOW*, WINDOW* );
  813. int     overwrite( WINDOW*, WINDOW* );
  814. int     pair_content( int, short*, short* );
  815. int     pnoutrefresh( WINDOW*, int, int, int, int, int, int );
  816. int     prefresh( WINDOW*, int, int, int, int, int, int );
  817. int     printw( char*,... );
  818. int     raw( void );
  819. int     refresh( void );
  820. int     resetterm( void );
  821. int     resetty( void );
  822. int     reset_prog_mode( void );
  823. int     reset_shell_mode( void );
  824. int     saveoldterm( void );
  825. int     saveterm( void );
  826. int     savetty( void );
  827. int     scroll( WINDOW* );
  828. int     start_color( void );
  829. int     tabsize( int );
  830. int     touchline( WINDOW*, int ,int );
  831. int     touchwin( WINDOW* );
  832. int     waddrawstr( WINDOW*, char* );
  833. int     waddstr( WINDOW*, char* );
  834. int     wattroff( WINDOW*, int );
  835. int     wattron( WINDOW*, int );
  836. int     wattrset( WINDOW*, int );
  837. int     wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  838. int     wbox( WINDOW*, int, int, int, int, chtype, chtype );
  839. int     wclrtobot( WINDOW* );
  840. int     wclrtoeol( WINDOW* );
  841. int     wdelch( WINDOW* );
  842. int     wdeleteln( WINDOW* );
  843. int     werase( WINDOW* );
  844. int     wgetch( WINDOW* );
  845. int     wgetstr( WINDOW*, char* );
  846. int     winsch( WINDOW*, chtype );
  847. int     winsertln( WINDOW* );
  848. int     wmove( WINDOW*, int, int );
  849. int     wnoutrefresh( WINDOW* );
  850. int     wprintw( WINDOW*, char*,... );
  851. int     wrefresh( WINDOW* );
  852. int     wsetscrreg( WINDOW*, int, int );
  853. int     wtabsize( WINDOW*, int );
  854. int     wungetch( chtype );
  855. SCREEN* newterm( char*, FILE*, FILE* );
  856. SCREEN* set_term( SCREEN* );
  857. WINDOW* initscr( void );
  858. WINDOW* newpad( int, int );
  859. WINDOW* newwin( int, int, int, int );
  860. WINDOW* subwin( WINDOW*, int, int, int, int );
  861. int     meta( WINDOW*, bool );
  862. int     gettmode( void );
  863. int     fixterm( void );
  864. int     cursoff( void );
  865. int     curson( void );
  866. int     curs_set( int );
  867.  
  868. #ifdef     PDCURSES
  869. int     resize( int );
  870. int     win_print( WINDOW*, int );
  871. WINDOW* resize_win( WINDOW*, int, int );
  872. int     raw_output( bool );
  873. #endif
  874.  
  875. int     scanw( char*,... );
  876. int     mvscanw( int, int, char*,... );
  877. int     mvwscanw( WINDOW*, int, int, char*,... );
  878. int     wscanw( WINDOW*, char*,... );
  879.  
  880. /*
  881. *       Keep the compiler happy with our macros below...
  882. */
  883. int     PDC_chadd( WINDOW*, chtype, bool, bool );
  884. int     PDC_chins( WINDOW*, chtype, bool );
  885.  
  886. #  ifdef   CPLUSPLUS
  887.      }
  888. #  endif
  889. #endif
  890.  
  891.  
  892.  
  893. /*
  894. *       Functions defined as macros
  895. */
  896. #ifndef max
  897. #define max(a,b) (((a) > (b)) ? (a) : (b))
  898. #endif
  899. #ifndef min
  900. #define min(a,b) (((a) < (b)) ? (a) : (b))
  901. #endif
  902.  
  903.  
  904. #define addch( c )              waddch( stdscr, c )
  905. #define addstr(str)             waddstr( stdscr, str )
  906. #define attroff(attr)           wattroff( stdscr, (chtype)attr )
  907. #define attron(attr)            wattron( stdscr, (chtype)attr )
  908. #define attrset(attr)           wattrset( stdscr, (chtype)attr )
  909. #define box( w, v, h )          wbox( w, 0, 0, 0, 0, v, h )
  910. #define can_change_color()      FALSE
  911. #define cbreak()                (_cursvar.cbreak = TRUE)
  912. #define clear()                 (clearok( stdscr, TRUE )==ERR?ERR:wclear( stdscr ))
  913. #define clrtobot()              wclrtobot( stdscr )
  914. #define clrtoeol()              wclrtoeol( stdscr )
  915. #define crmode()                (_cursvar.cbreak = TRUE)
  916. #define delch()                 wdelch( stdscr )
  917. #define deleteln()              wdeleteln( stdscr )
  918. #define erase()                 werase( stdscr )
  919. #define getch()                 wgetch(stdscr)
  920. #define getstr(str)             wgetstr( stdscr, str )
  921. #define getyx(w,y,x)            ( y = (w)->_cury, x = (w)->_curx )
  922. #define getbegyx(w,y,x)         ( y = (w)->_begy, x = (w)->_begx )
  923. #define getmaxyx(w,y,x)         ( y = (w)->_maxy, x = (w)->_maxx )
  924. #define has_colors()            ((_cursvar.mono) ? FALSE : TRUE)
  925. #define has_ic()                TRUE
  926. #define has_il()                TRUE
  927. #define idlok()                 OK
  928. #define inch()                  (stdscr->_y[stdscr->_cury][stdscr->_curx])
  929. #define insch( c )              winsch( stdscr, c )
  930. #define insertln()              winsertln( stdscr )
  931. #define isendwin()              ((_cursvar.alive) ? FALSE : TRUE)
  932. #define keypad(w,flag)          (w->_use_keypad  = flag)
  933. #define leaveok(w,flag)         (w->_leave   = flag)
  934. #define move(y,x)               wmove( stdscr, y, x )
  935. #define mvaddch(y,x,c)          (move( y, x )==ERR?ERR:addch( c ))
  936. #define mvaddstr(y,x,str)       (move( y, x )==ERR?ERR:addstr( str ))
  937. #define mvdelch(y,x)            (move( y, x )==ERR?ERR:wdelch( stdscr ))
  938. #define mvgetch(y,x)            (move( y, x )==ERR?ERR:wgetch(stdscr))
  939. #define mvgetstr(y,x,str)       {move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
  940. #define mvinch(y,x)             (wmove(stdscr,y,x)==ERR?ERR:(w->_y[y][x]))
  941. #define mvinsch(y,x,c)          (move( y, x )==ERR?ERR:winsch( stdscr, c ))
  942. #define mvwaddch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
  943. #define mvwaddstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
  944. #define mvwaddrawch(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
  945. #define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
  946. #define mvwdelch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wdelch( w ))
  947. #define mvwgetch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wgetch( w ))
  948. #define mvwgetstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
  949. #define mvwinch(w,y,x)          (wmove(w,y,x)==ERR?ERR:(w->_y[y][x]))
  950. #define mvwinsch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
  951. #define napms(ms)               delay_output(ms)
  952. #define nl()                    (_cursvar.autocr = TRUE)
  953. #define nocbreak()              (_cursvar.cbreak = FALSE)
  954. #define nocrmode()              (_cursvar.cbreak = FALSE)
  955. #define nodelay(w,flag)         (w->_nodelay = flag)
  956. #define noecho()                (_cursvar.echo = FALSE)
  957. #define echo()                  (_cursvar.echo = TRUE)
  958. #define nonl()                  (_cursvar.autocr = FALSE)
  959. #define refrbrk(flag)           (_cursvar.refrbrk = flag)
  960. #define refresh()               wrefresh( stdscr )
  961. #define scrollok(w,flag)        (w->_scroll  = flag)
  962. #define setscrreg(top, bot)     wsetscrreg( stdscr, top, bot )
  963. #define standend()              wstandend( stdscr )
  964. #define standout()              wstandout( stdscr )
  965. #define ungetch(c)              wungetch(c)
  966. #define waddch(w, c)            PDC_chadd( w, (chtype)c, (bool)!(_cursvar.raw_out), TRUE )
  967. #define wclear(w)               ( werase( w )==ERR?ERR:(w->_clear = TRUE))
  968. #define winch(w)                (w->_y[w->_cury][w->_curx])
  969. #define wstandend(w)            (wattroff(w, A_STANDOUT)==ERR?ERR:(w->_attrs = 0))
  970. #define wstandout(w)            wattrset(w, A_STANDOUT);
  971. #define echochar(c)             (addch((chtype)c)==ERR?ERR:refresh())
  972. #define wechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
  973. #define pechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:prefresh(w))
  974.  
  975. #ifdef     PDCURSES
  976. #define addrawch( c )           waddrawch( stdscr, c )
  977. #define addrawstr(str)          waddrawstr( stdscr, str )
  978. #define insrawch( c )           winsrawch( stdscr, c )
  979. #define waddrawch(w, c)         PDC_chadd( w, (chtype)c, FALSE, TRUE )
  980. #define winsrawch(w, c)         PDC_chins( w, (chtype)c, FALSE )
  981.  
  982. /*
  983.  *      FYI: Need to document these functions...
  984.  */
  985. #define title(s,a)              wtitle( stdscr, s, (chtype)a )
  986. #define titleofs(ofs)           wtitleofs( stdscr, ofs )
  987. #define wtitle(w,s,a)           (w->_title = s, w->_title_attr = (chtype)a)
  988. #define wtitleofs(w,ofs)        (w->_title_ofs = ofs)
  989. #endif
  990.  
  991. /*
  992.  *      Load up curspriv.h.     This should be in the same place as
  993.  *      curses.h.  We allow anyone who defines CURSES_LIBRARY to have
  994.  *      access to our internal routines.  This provides quick
  995.  *      PC applications at the expense of portability.
  996.  */
  997. #if defined     (CURSES_LIBRARY) | defined( INTERNAL)
  998. #  include <curspriv.h>
  999. #  include <stdlib.h>
  1000. #endif
  1001.  
  1002. #endif  /* __PDCURSES__ */
  1003.